package com.audaque.springboot.foshanupload.web.webdemo.mapper;

import com.audaque.springboot.foshanupload.web.webdemo.model.domain.Car;
import com.audaque.springboot.foshanupload.web.webdemo.model.dto.CarDto;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

@Mapper
public interface CarMapper {
    @Mapping(target = "numberOfSeats", source = "seatCount")
    Car carDtoToCar(CarDto car);


    //如果可以使用多个方法作为继承的源，则必须在注释中指定方法名称：@InheritConfiguration( name = “carDtoToCar” )。
    @InheritConfiguration
    void carDtoIntoCar(CarDto carDto, @MappingTarget Car car);
}


